﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../../lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    </style>
    <script src="../../lib/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>  
    <script src="../../lib/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="../../lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
    <script src="../../lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
    <script src="../../lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script> 
    <script src="../../lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script> 
    <script type="text/javascript">

        var dialog = null, combobox;
        $(function ()
        { 
            combobox = $("#test1").ligerComboBox({
                data: [
                    { text: '张三', id: '1' },
                    { text: '李四', id: '2' },
                    { text: '赵武', id: '44' }
                ],
                emptyText: '',            //空行
                addRowButton: '新增',           //新增按钮
                addRowButtonClick: function ()  //新增事件
                {
                    combobox.clear();
                    dialog = $.ligerDialog.open({
                        height: 300,
                        width: 400,
                        title: '打开窗口提示',
                        url: 'addNew.htm',
                        showMax: false,
                        showToggle: true,
                        showMin: false,
                        isResize: true,
                        slide: false,
                        data: {
                            callback: afterSave
                        }
                    });
                }
            });
        });
        function afterSave(data)
        {
            dialog.close(); 
            combobox.addItem(data); 
            combobox.setValue(data.id, data.text);
        }
        
    </script>
</head>
<body style="padding:10px"> 
      <input type="text" id="test1" /> 
</body>
</html>
